package com.bitcat.todoapp

import android.app.Application
import com.scwang.smart.refresh.footer.ClassicsFooter
import com.scwang.smart.refresh.header.ClassicsHeader
import com.scwang.smart.refresh.layout.SmartRefreshLayout


val appContext by lazy { MyApplication.instance }

//MyApplication本质上就是Context
class MyApplication : Application() {


    companion object {
        lateinit var instance: MyApplication

        init {
            //配置全局的下拉刷新样式
            SmartRefreshLayout.setDefaultRefreshHeaderCreator { context, layout ->
                ClassicsHeader(appContext)
            }
            SmartRefreshLayout.setDefaultRefreshFooterCreator  { context, layout ->
                ClassicsFooter(appContext)
            }
        }
    }


    override fun onCreate() {
        super.onCreate()
        instance = this
    }
}